<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width" name="viewport" />
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />
<title>无标题文档</title>
    <script src="js/jquery.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <#include "public/app/mxcss.ftl">
    <script src="/jquery-2.2.3.min.js"></script>
    <script src="/method.js"></script>
</head>

<body>
<article class="hometop"><a href="javascript:history.back(-1);" class="left"><img src="../images/arrow-left.png"></a> <span>修改登录密码</span> </article>
<article class="usercenter">
    <section class="two">
    	<p>请输入新登录密码</p>
        <section class="userlist">
            <ul>
                <li>
                    <ul>
                        <li class="fl"><input type="text" id="newPassword" placeholder="输入新登录密码"></li>
                        <#if Session.user??>
                        <input type="hidden" id="userPhone" value="${Session.user.phone?if_exists}">
                        </#if>
                    </ul>
                </li>
                <li>
                    <ul>
                        <li class="fl"><input type="text" id="rePassword" placeholder="重复新登录密码"></li>
                    </ul>
                </li>
			</ul>
		</section>
<#--        <aside class="ml22 mr22 mb22 mt22"> <a href="javascript:changPassword();" class="btn btn-orange">下一步</a> </aside>-->
        <aside class="ml22 mr22 mb22 mt22"> <a href='javascript:void(0)' onclick='changePassword()' class="btn btn-orange">下一步</a> </aside>
    </section>
</article>

<script>
    function changePassword(){
        var newPassword = $("#newPassword").val();
        var rePassword = $("#rePassword").val();
        var userPhone = $("#userPhone").val();
        if(newPassword == ""){
            alert("输入新登录密码不能为空");
            return ;
        }
        if(rePassword == ""){
            alert("重复新登录密码不能为空");
            return ;
        }
        if(newPassword != rePassword){
            alert("新密码与确认密码必须一致");
            return ;
        }

        var data = {password:newPassword,phone:userPhone};
        var url = "/securitycenter/changepassword";
        postReq(url,data,function(result){
            if(result.success){
                return location.href="/securitycenter/changelogpasswordsuccess";
            }else{
                alert("修改失败"+result.msg);
            }
        })
    }
</script>
</body>
</html>